package com.chouren.goandroid.http.exception;

/**
 * 客户端请求异常
 * @version 1.0 
 * @author Administrator
 * @date 2014年7月2日
 * @update 2014年7月2日
 */
public class HttpClientException extends HttpException {
	private static final long serialVersionUID = 2565103726502412060L;
	private ClientException exceptionType;
	
	/** 客户端网络请求的错误类型   */
	public enum ClientException {
		UrlIsNull("Url Is Null", "url 为空"),
		UnknowException("Unknow Exception", "未知错误");
		
		public String reason;
		public String reasonInChinese;
		
		ClientException(String reason, String reasonInChinese) {
			this.reason = reason;
			this.reasonInChinese = reasonInChinese;
		}
	}
	
	public HttpClientException(ClientException clientException) {
		super(useChinese ? clientException.reasonInChinese : clientException.reason);
		exceptionType = clientException;
	}
	
	public HttpClientException(Throwable cause) {
		super(cause.toString(), cause);
		exceptionType = ClientException.UnknowException;
	}

	public ClientException getExceptionType() {
		return exceptionType;
	}

	public void setExceptionType(ClientException exceptionType) {
		this.exceptionType = exceptionType;
	}
}
